package com.biblio.dom;




import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Table;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;

import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.NotBlank;


@Entity
@Table(name="Account")
public class Account extends BaseEntity{
	
	public enum Role
	{
		USER("user"),MANAGER("manager"),ADMIN("admin");	
		
		private String name;
		Role(String name) {
			this.setName(name);
		}
		public String getName() {
			return name;
		}
		public void setName(String name) {
			this.name = name;
		}
		
	}
	

    @Column(unique = true, nullable=false)
    @Size(max = 25, message = "votre pseudonyme ne peut contenir que 25 caractères maximum")
    @NotBlank(message="entrer votre pseudonyme")
    @Pattern(message ="ne peut contenir que des caractère alphanumériques, sans accents. Les 2 caractères \"-\" et \"_\" sont autorisés, mais pas les espaces.", regexp="[A-Za-z0-9_-]{2,256}")
	private String userName;
    @Column(length = 100)
    @Size(min = 4, message = "votre mot de passe doit contenir au moins 4 caractères")	
	private String pwd;	
   // @Enumerated(EnumType.STRING)
    @Column(columnDefinition = "VARCHAR(50) default 'user'")
	private String userType;
    @Column(unique = true, nullable=false,length = 100)
    @Email(message ="adresse mail pas valide", regexp="^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,6}$")
	private String email;
    @Column(length = 50)
    @Size(max=50, message="votre prénom ne peut contenir que 50 caractères maximum")    
	private String firstName;
    @Column(length = 50)
    @Size(max=50, message="votre nom ne peut contenir que 50 caractères maximum")   
	private String lastName;	
    @Column(length = 250)
    @Size(max=250, message="votre adresse ne peut contenir que 250 caractères maximum")    
	private String adress;
    @Column(length = 100)
    @Size(max=100, message="La ville ne peut contenir que 100 caractères maximum")    
	private String city;
    @Column(length = 100)
    @Size(max=100, message="Le pays ne peut contenir que 100 caractères maximum")    
	private String country;
	private String avatar;
	
	
	public String getPwd() {
		return pwd;
	}
	public void setPwd(String pwd) {
		this.pwd = pwd;
	}
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public String getFirstName() {
		return firstName;
	}
	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}
	public String getLastName() {
		return lastName;
	}
	public void setLastName(String lastName) {
		this.lastName = lastName;
	}
	public String getAdress() {
		return adress;
	}
	public void setAdress(String adress) {
		this.adress = adress;
	}
	public String getCity() {
		return city;
	}
	public void setCity(String city) {
		this.city = city;
	}
	public String getCountry() {
		return country;
	}
	public void setCountry(String country) {
		this.country = country;
	}
	public String getAvatar() {
		return avatar;
	}
	public void setAvatar(String avatar) {
		this.avatar = avatar;
	}
	public String getUserName() {
		return userName;
	}
	public void setUserName(String userName) {
		this.userName = userName;
	}
	public String getUserType() {
		return userType;
	}
	public void setUserType(String userType) {
		this.userType = userType;
	}


}
